/*
*	ID : pallab81
* 	PROG : 10645
* 	LANG : C++
* 	2012-06-16-10.14.07 Saturday
*
* 	"I have not failed, I have just found 10000 ways that won't work.
*/

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;


#define foR(i1,st,ed) for(int i1 = st , j1 = ed ; i1 < j1 ; ++i1 )
#define fo(i1,ed) foR( i1 , 0 , ed )
#define foE(i1,st,ed) foR( i1, st, ed+1 )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )
#define line puts("")

template<class T1>
inline void debug(T1 _x) {
    cout<<_x<<'\n';
}
template<class T1, class T2>
inline void debug(T1 _x,T2 _y) {
    cout<<_x<<' '<<_y<<'\n';
}
template<class T1, class T2, class T3>
inline void debug(T1 _x,T2 _y,T3 _z) {
    cout<<_x<<' '<<_y<<' '<<_z<<'\n';
}
template<class T1, class T2, class T3, class T4>
inline void debug(T1 _x,T2 _y,T3 _z,T4 _zz) {
    cout<<_x<<' '<<_y<<' '<<_z<<' '<<_zz<<'\n';
}
template< class T1>
inline void debug(T1 _array,int _size) {
    cout<<"[";
    for (int i=0; i<_size; ++i) {
        cout<<' '<<_array[i];
    }
    puts(" ]");
}
inline bool CI(int &_x) {
    return scanf("%d",&_x)==1;
}
inline bool CI(int &_x, int &_y) {
    return CI(_x)&&CI(_y) ;
}
inline bool CI(int &_x, int &_y, int &_z) {
    return CI(_x)&&CI(_y)&&CI(_z) ;
}
inline bool CI(int &_x, int &_y, int &_z, int &_zz) {
    return CI(_x)&&CI(_y)&&CI(_z)&&CI(_zz) ;
}
inline void wait( double seconds ) {
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ) {
        ;
    }
}
struct Node {
    int C;
    int P;
    int id;
    Node( int C=0, int P=0, int id=0):
        C(C),P(P),id(id) {
        ;
    }
};

inline bool cmp(Node A, Node B) {
    return ( A.C < B.C );
}
namespace In {
int N,K,M;
Node dishes[55];

inline bool read() {
    CI(K,N,M);
    return N || M || K ;
}
inline void readMore() {
    fo(i,N) {
        CI( dishes[i].C, dishes[i].P );
        dishes[i].id=i+1;
    }
    sort(dishes,dishes+N,cmp);
}
}
const double inf = 1023456789;
const double eps = 1e-9;
namespace Algo {
double dp[25][105][55][30];
bool vis[25][105][55][30];

double go(int at, int budget,int prv, int cnt) {
    if(at>=In::K)return 0;

    if( vis[at][budget][prv][cnt] ) {
        return dp[at][budget][prv][cnt];
    }
    vis[at][budget][prv][cnt]=true;
    double best = -inf;

    //do the current work
    if( budget-In::dishes[prv].C >=0 ) {
        double profit = 0;
        if( cnt==0 ) {
            profit = In::dishes[prv].P;
            double a = profit+go(at+1, budget-In::dishes[prv].C, prv, cnt+1 );
            best=max(best, a);
        } else if(cnt==1) {
            profit = In::dishes[prv].P;
            profit/=2.;
            double a = profit+go(at+1, budget-In::dishes[prv].C, prv, cnt+1 );
            best=max(best, a);
        } else if(cnt>1) {
            double a = profit+go(at+1, budget-In::dishes[prv].C, prv, cnt+1 );
            best=max(best, a);
        }

    }

    //do another work
    fo(i,In::N) {
        if(i!=prv) {
            if( budget-In::dishes[i].C>=0 )
                best = max( best, (double)In::dishes[i].P+go(at+1, budget-In::dishes[i].C, i, 1) );
        }
    }
    return dp[at][budget][prv][cnt]=best;
}

void bk(int at, int budget, int prv, int cnt, double ret) {
    if(at>=In::K)return ;


    //do the current work
    if( budget-In::dishes[prv].C >=0 ) {
        double profit = 0;
        if( cnt==0 ) {
            profit = In::dishes[prv].P;
            double a = profit+go(at+1, budget-In::dishes[prv].C, prv, cnt+1 );
            //debug(1, ret, a);
            if( abs(ret-a)<=eps ) {
                cout<<In::dishes[prv].id<<' ';
                bk(at+1, budget-In::dishes[prv].C, prv, cnt+1 , ret-profit);
                return ;
            }
        } else if(cnt==1) {
            profit = In::dishes[prv].P;
            profit/=2.;
            double a = profit+go(at+1, budget-In::dishes[prv].C, prv, cnt+1 );
            //debug(2, ret, a);
            if( abs(ret-a)<=eps ) {
                cout<<In::dishes[prv].id<<' ';
                bk(at+1, budget-In::dishes[prv].C, prv, cnt+1 , ret-profit);
                return ;
            }
        } else if(cnt>1) {
            double a = profit+go(at+1, budget-In::dishes[prv].C, prv, cnt+1 );
            //debug("3+", ret, a);
            if( abs(ret-a)<=eps ) {
                cout<<In::dishes[prv].id<<' ';
                bk(at+1, budget-In::dishes[prv].C, prv, cnt+1 , ret-profit);
                return ;
            }
        }

    }

    //do another work
    fo(i,In::N) {
        if(i!=prv) {
            if( budget-In::dishes[i].C>=0 ) {
                double a = (double)In::dishes[i].P+go(at+1, budget-In::dishes[i].C, i, 1) ;
                if( a==ret ) {
                    cout<<In::dishes[i].id<<' ';
                    bk(at+1, budget-In::dishes[i].C, i, 1 , ret-In::dishes[i].P );
                    return ;
                }
            }
        }
    }
    return ;
}

inline void Solve() {
    SET(vis,false);
    double ret = max( go(0,In::M, 0, 0), 0. );
    cout<<ret;
    line;

    if(ret>eps) {
        bk(0,In::M,0,0,ret);
    }
    cout<<'\n';
}
}

#define FILE
//#define showCase
int main() {
#ifdef FILE
    freopen("/home/xerxes/Documents/10645/in","rt",stdin);
#endif

    cout<<setprecision(1)<<fixed;
    while( In::read() ) {
        In::readMore();
        Algo::Solve();

    }

    return 0;
}
